package com.questionnaires.service;

import com.questionnaires.exception.NotExistsException;
import com.questionnaires.exception.NotUniqueException;
import com.questionnaires.model.Category;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Represents a service for handling category related business operations.
 *
 * @author rominamilea@gmail.com
 */

public interface CategoryService {

    /**
     * Adds or updates a given category.
     *
     * @param category the category to be added or updated
     * @throws com.questionnaires.exception.NotUniqueException thrown if a category with the same name is added
     */
    void saveOrUpdate(Category category) throws NotUniqueException;

    /**
     * Removes the category with the specified id.
     *
     * @param id the category id to be deleted
     * @throws com.questionnaires.exception.NotExistsException thrown if the specified category does not exists
     */
    void delete(long id) throws NotExistsException;

    /**
     * Retrieves all categories.
     *
     * @return a list of all categories
     */
    List<Category> findAll();

}
